package com.itheima.day3.stream;

import java.util.List;

public class C08MatchTest {
    public static void main(String[] args) {
        List<Integer> list = List.of(1, 2, 3, 4, 5, 1, 2);

        // anyMatch 任意一个元素满足，返回 true
        System.out.println(list.stream().anyMatch(x -> (x & 1) == 0));

        // allMatch 所有元素满足，返回 true
        System.out.println(list.stream().allMatch(x -> (x & 1) == 0));

        // noneMatch 所有元素都不满足，返回 true
        System.out.println(list.stream().noneMatch(x -> (x & 1) == 0));
    }
}
